<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./font_3776975_u9g2pouab/iconfont.css">
    <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }

        .left {
            width: 15%;
            height: 800px;
            background-color: rgb(76, 74, 74);
            float: left;
            color: white;
        }

        .left .logo {
            width: 100%;
            height: 50px;
            border-bottom: 1px solid white;
            /* color: white; */
            text-align: center;
            line-height: 50px;
        }

        .left .user {
            height: 60px;
            border-bottom: 1px solid white;
            /* color: white; */
            text-align: center;
            line-height: 60px;
        }

        .left .nav {
            list-style: none;
        }

        .left .nav li:hover{
            background-color: blueviolet;
        }
        .left .nav li {
            cursor: pointer;
            height: 40px;
            line-height: 40px;
            /* border-bottom: 1px solid white; */
            padding-left: 30px;
            transition: all 0.3s;
        }

        .right {
            width: 85%;
            height: 800px;
            background-color: rgb(251, 237, 237);
            float: right;
        }

        .right .top {
            width: 100%;
            height: 50px;
            /* border-bottom: 1px solid gray; */
            color: gray;
            background-color: white;
        }

        .right .top ul {
            list-style: none;
            height: 50px;
        }

        .ul1 {
            float: left;
        }

        .ul2 {
            float: right;
        }

        .right .top .ul1 li {
            float: left;
            margin-left: 30px;
            line-height: 50px;
        }

        .right .top .ul1 li input {
            padding-left: 10px;
            padding-right: 10px;
            background-color: rgb(251, 237, 237);
            border: none;
            height: 25px;
            border-radius: 5px;
        }

        .right .top .ul2 li {
            float: left;
            margin-right: 30px;
            line-height: 50px;
        }

        .right h2 {
            font-weight: 400;
            margin-left: 30px;
            margin-top: 20px;
        }

        .right .box2 {
            width: 600px;
            height: 300px;
            background-color: white;
            margin-left: 30px;
            margin-top: 20px;
            float: left;
        }

        /* .right .data{
        } */
        .right .data .zuo {
            font-size: 18px;
            float: left;
            margin-left: 25px;
            font-weight: 800;
            margin-top: 20px;
        }

        .right .data .you {
            float: right;
            margin-right: 25px;
            margin-top: 20px;
            font-weight: 800;
        }

        .right .data .you span {
            margin-left: 20px;
        }

        .right .data .list {
            clear: both;
            padding: 10px 30px;
            width: 100%;
        }

        .right .data .list thead {
            font-weight: 800;
        }

        .right .data .list thead td:nth-child(1) {
            width: 30%;
        }

        .right .data .list thead td:nth-child(2) {
            width: 20%;
        }

        .right .data .list thead td:nth-child(3) {
            width: 30%;
        }

        .right .data .list thead td:nth-child(4) {
            width: 20%;
        }

        .right .data .list td {
            height: 35px;
            text-align: left;
        }

        .right .data .list tr td:nth-child(1) {
            text-align: left;
        }
        
        .right .oso ul{
            list-style: none;
            clear: both;
            padding: 30px 30px;
        }
        .right .oso ul li{
            height: 50px;   
            /* background-color: gray; */
            transition: all 0.5s;
            border-bottom: 1px solid gray;
            
        }
        .right .oso ul li span{
            line-height: 50px;
        }
        .right .oso ul li p{
            text-align: right;
        }
        .right .oso ul li:hover{
            background-color: rgb(227, 227, 227);
        }
        .right .oso ul span{
            float: left;
        }
        .right .oso ul p{
            float: right;
        }
        .icon-sousuo{
            font-size: 24px;
        }
        .yy{
            float: right;
            margin-right: 25px;
        }
        .you{
            color: gray;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="left">
            <div class="logo"><span class="iconfont icon-apple-fill"></span>&emsp;&emsp;admin</div>
            <div class="user"><span class="iconfont icon-03"></span>&emsp;&emsp;alexand</div>
            <ul class="nav">
                <li><span class="iconfont icon-huaban"></span>&emsp;&emsp;Dashboard<span class="yy">&lt;</span></li>
                <li><span class="iconfont icon-caidan"></span>&emsp;&emsp;Widgets<span class="yy">&lt;</span></li>
                <li><span class="iconfont icon-24gf-chartPie"></span>&emsp;&emsp;Charts<span class="yy">&lt;</span></li>
                <li><span class="iconfont icon-shu"></span>&emsp;&emsp;UI Elements<span class="yy">&lt;</span></li>
                <li><span class="iconfont icon-a-bijibenbiji"></span>&emsp;&emsp;Forms<span class="yy">&lt;</span></li>
                <li><span class="iconfont icon-table"></span>&emsp;&emsp;Tables<span class="yy">&lt;</span></li>
            </ul>
            <br>
            <ul class="nav">
                <li>Dashboard</li>
                <li><span class="iconfont icon-riqi"></span>&emsp;&emsp;Widgets<span class="yy">&lt;</span></li>
                <li><span class="iconfont icon-youxiang"></span>&emsp;&emsp;Charts<span class="yy">&lt;</span></li>
                <li><span class="iconfont icon-tushu"></span>&emsp;&emsp;UI Elements<span class="yy">&lt;</span></li>
                <li><span class="iconfont icon-pinleizengjia_o"></span>&emsp;&emsp;Forms<span class="yy">&lt;</span></li>
                <li><span class="iconfont icon-table"></span>&emsp;&emsp;Tables<span class="yy">&lt;</span></li>
            </ul>
        </div>
        <div class="right">
            <div class="top">
                <ul class="ul1">
                    <li><span class="iconfont icon-caidan1"></span></li>
                    <li>Home</li>
                    <li>Contact</li>
                    <li><input type="search" placeholder="请输入你想搜索的内容"></li>
                </ul>
                <ul class="ul2">
                    <li>通知</li>
                    <li>🔔</li>
                    <li>菜单</li>
                </ul>

            </div>
            <h2>Dashboard v3</h2>
            <div class="box2" id="con"></div>
            <div class="box2" id="con2"></div>
            <div class="box2 data">
                <p class="zuo">Products</p>
                <p class="you">
                    <span class="iconfont icon-xiazai"></span>
                    <span class="iconfont icon-caidan1"></span>
                </p>
                <table class="list">
                    <thead>
                        <tr>
                            <td>Produce</td>
                            <td>Price</td>
                            <td>Sales</td>
                            <td>More</td>
                        </tr>
                    </thead>
                    <tbody>

                    </tbody>
                </table>
            </div>
            <div class="box2 data oso">
                <p class="zuo">Online Store Overview</p>
                <p class="you">
                    <span class="iconfont icon-xiazai"></span>
                    <span class="iconfont icon-caidan1"></span>
                </p>
                <ul>
                    <li><span>⭐</span><p>12% <br> CONVERSION RATE</p></li>
                    <li><span>⭐</span><p>0.8% <br> SALEA RATE</p></li>
                    <li><span>⭐</span><p>12% <br> CONVERSION RATE</p></li>
                    <li><span>⭐</span><p>12% <br> CONVERSION RATE</p></li>
                </ul>
            </div>
        </div>
    </div>
</body>

</html>
<script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.4.0/echarts.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/Mock.js/1.0.0/mock.js"></script>
<script src="promise封装.js"></script>
<script src="./data2.js"></script>
<script>
    var con = document.querySelector('#con')
    var con2 = document.querySelector('#con2')
    var e = echarts.init(con)
    var e2 = echarts.init(con2)
    let content = document.querySelector('tbody')

    // 第一个图
    e.setOption({
        title: {
            text: 'Online',
            left: '20',
            top: '20'
        },
        legend: { //图例
            top: 255,
        },
        xAxis: {
            data: ['18th', '20th', '22th', '24th', '26th', '28th', '30th']
        },
        yAxis: {
            splitLine: {
                show: true
            }
        },
        // 数据
        series: [
            // 折线图
            {
                name: 'This Week',
                type: 'line',
                data: [100, 120, 170, 165, 181, 175, 160],
                symbolSize: 8,
                symbol: 'circle',//圆点形状
                smooth: true,
                itemStyle: {
                    normal: {
                        color: '#7873f5'
                    }
                }

            },
            {
                name: 'Last Week',
                type: 'line',
                data: [60, 80, 70, 65, 80, 75, 105],
                symbolSize: 8,
                symbol: 'circle',//圆点形状
                smooth: true,
                itemStyle: {
                    normal: {
                        color: 'rgb(163, 162, 162)'
                    }
                }

            }
        ]
    })
    // 第二个图
    e2.setOption({
        title: { //图表的标题
            text: 'Sales',
            left: '20',
            top: '20'
        },
        legend: { //图例
            top: 255,
            // right:10,
        },
        xAxis: { //x轴设置
            data: ['JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC']
        },
        yAxis: { //y轴设置
            splitLine: {
                show: true
            }
        },
        series: [ //数据系列
            {
                name: 'This year',
                barWidth: 20, //柱子的宽度
                // showBackground: true,//显示背景色
                backgroundStyle: {
                    //color: '',
                    borderRadius: 20, //背景圆角
                },
                // itemStyle: {
                //     //borderRadius:[20,0,20,0],//边框圆角 
                //     borderRadius: [20],//边框圆角 
                // },
                // color:
                type: 'bar',//'line' , 'bar' , 'pie'
                data: [1000, 2000, 3000, 2500, 2600, 2500, 3000]
            },
            {
                name: 'Last year',
                barWidth: 20, //柱子的宽度
                // showBackground: true,//显示背景色
                backgroundStyle: {
                    //color: '',
                    borderRadius: 20, //背景圆角
                },
                // itemStyle: {
                //     //borderRadius:[20,0,20,0],//边框圆角 
                //     borderRadius: [20],//边框圆角 
                // },
                color: 'rgb(163, 162, 162)',
                type: 'bar',//'line' , 'bar' , 'pie'
                data: [800, 1800, 2800, 2000, 1800, 1500, 2000]
            }
        ]
    });
    // 给第三个图随机渲染数据
    function render(data) {
        // console.log(data);
        var str = data.map(function (item) {
            return `<tr>
                <td>${item.name}</td>
                <td>${item.price}&emsp;USD</td>
                <td>↑&emsp;${item.sales}&emsp;Sold</td>
                <td><span class='iconfont icon-sousuo'></span></td>
            </tr>`
            // console.log(item);
        }).join('')
        content.innerHTML=str
    }
    render(data2.list)
</script>